<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="format-detection" content="telephone=no"/>
<meta name="wap-font-scale" content="no">
<meta name="renderer" content="webkit">
<title>AutoCode</title>
<link rel="shortcut icon" href="/favicon.ico" />
<script src="/links/jquery/jquery-3.5.1.min.js"></script>
<script src="/links/polyfill.min.js"></script>
<script src="/links/axios/axios.min.js"></script>
<script src="/links/vue/vue.min.js"></script>
<script src="/links/element-ui/index.js"></script>
<script src="/links/dayjs.min.js"></script>
<script src="/links/echarts/echarts.min.js"></script>
<script src="/links/JsBarcode.all.js"></script>
<script src="/links/qrcode.min.js"></script>
<script src="/links/layer/layer.js"></script>
<script src="/js/dragController.js"></script>
<script src="/js/HttpApi.js"></script>
<script src="/js/AutoCode.js"></script>
<link href="/links/element-ui/theme/index.css" rel="stylesheet"/>
<link href="/css/default.css" rel="stylesheet"/>
<link href="/css/dragController.css" rel="stylesheet"/>

<script src="/links/ace/src/ace.js"></script>
<script src="/links/ace/src/ext-language_tools.js"></script>
<script src="/links/beautify/beautify.min.js"></script>
<script src="/links/beautify/beautify-css.min.js"></script>
<script src="/links/beautify/beautify-html.min.js"></script>
    <style>
        
    </style>
</head>
<body>
<div id="app"  class="box" >
<div class="left" style="width:400px;">
<div class="flex ac-tree-head ac-tree-head-default-line">
    <div class="ac-tree-title"></div>
    <div class="ac-tree-oper">
        <el-button size="medium"  v-if="sqlTree.operVisible.buttonA==undefined || sqlTree.operVisible.buttonA" @click="sqlTree_openSqlAdd()" :disabled="sqlTree.operDisabled.buttonA"  type="text"     native-type="button">添加SQL(A)</el-button>
<el-button size="medium"  v-if="sqlTree.operVisible.buttonQ==undefined || sqlTree.operVisible.buttonQ" @click="sqlTree_load()" :disabled="sqlTree.operDisabled.buttonQ"  type="text"     native-type="button">刷新(Q)</el-button>

    </div>
</div>
<div style="padding:5px 10px;">
    <el-input size="mini" placeholder="输入关键字进行过滤" v-model="sqlTree.filterValue"></el-input>
</div>
<div class="ac-tree-content2">
    <el-tree ref="sqlTree" :data="sqlTree.data"
    :expand-on-click-node="false" node-key="id" empty-text="内容为空"
    highlight-current :current-node-key="sqlTree.currentNodeKey"  
       
    :filter-node-method="sqlTree_filterNodeMethod"
    draggable :allow-drag="sqlTree_allowDrag" :allow-drop="sqlTree_allowDrop" @node-drop="sqlTree_nodeDrop"
    
    @current-change="sqlTree_currentChange"
    >
    <span class="custom-tree-node" slot-scope="{ node, data }">
    <span>
        <i class="el-icon-document" v-if="data.type=='datasource'" style="color:rgb(250,170,57);"></i>
        <i class="el-icon-folder" style="color:rgb(250,170,57);" v-else></i>
        {{data.label}}
    </span>
    <span>
        <el-dropdown v-if="data.type=='datasource'" size="small" @command="sqlTree_treeCommand">
            <el-link icon="el-icon-more"></el-link>
            <el-dropdown-menu slot="dropdown">
                <el-dropdown-item :command="{'flag':'del','nodeData':data}">删除</el-dropdown-item>
                <el-dropdown-item :command="{'flag':'changeCategory','nodeData':data}">变更目录</el-dropdown-item>
            </el-dropdown-menu>
        </el-dropdown>
    </span>
</span>
</el-tree>

</div>
</div>
<div class="resize"></div>
<div class="right" style="width:calc(100% - 405px);">
<div class="box"><div class="topBox" style="height:280px;">
 <div class="flex ac-form-head ac-form-head-default-line">
    <div class="ac-form-title"></div>
    <div class="ac-form-oper"><el-button size="medium"  v-if="sqlDetail.operVisible.buttonE==undefined || sqlDetail.operVisible.buttonE" @click="sqlDetail_editSqlEdit()" :disabled="sqlDetail.operDisabled.buttonE"  type="text"     native-type="button">编辑(E)</el-button>
</div>
</div>
<div class="ac-form-content">
    <el-form class="ac-form-detail"  label-width="100px" label-position="right"
     size="mini" ref="sqlDetail" :model="sqlDetail.data" :rules="sqlDetail.rules"  
     :disabled="sqlDetail.disabled" >
    <el-row><el-col :span=24 v-if="sqlDetail.itemVisible.code==undefined || sqlDetail.itemVisible.code">
     <el-form-item label="数据源代码">
    {{sqlDetail.data.categoryCode}}.{{sqlDetail.data.code}}
</el-form-item>
</el-col>
<el-col :span=24 v-if="sqlDetail.itemVisible.label==undefined || sqlDetail.itemVisible.label">
    <el-form-item prop="label" label="数据源名称">
        {{sqlDetail.data.label}}

    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlDetail.itemVisible.selectTable==undefined || sqlDetail.itemVisible.selectTable">
    <el-form-item prop="selectTable" label="查询表">
        {{sqlDetail.data.selectTable}}

    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlDetail.itemVisible.selectColumn==undefined || sqlDetail.itemVisible.selectColumn">
    <el-form-item prop="selectColumn" label="查询列">
        {{sqlDetail.data.selectColumn}}

    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlDetail.itemVisible.orderBy==undefined || sqlDetail.itemVisible.orderBy">
    <el-form-item prop="orderBy" label="order by">
        {{sqlDetail.data.orderBy}}

    </el-form-item>
</el-col>
</el-row>
 </el-form>

</div>
</div>
<div class="move"></div>
<div class="downBox" style="height:calc(100% - 285px);">
<el-tabs type="border-card" v-model="page.tabs"  >
<el-tab-pane label="参数设置" name="tab1" :disabled="tabDisabled.tab1" v-if="tabVisible.tab1" >
<div class="flex ac-table-head">
    <div class="ac-table-oper"><el-button size="medium"  v-if="sqlParams.operVisible.buttonA==undefined || sqlParams.operVisible.buttonA" @click="sqlParams_openSqlParamAdd()" :disabled="sqlParams.operDisabled.buttonA"  type="text"     native-type="button">添加(A)</el-button>
<el-button size="medium"  v-if="sqlParams.operVisible.buttonE==undefined || sqlParams.operVisible.buttonE" @click="sqlParams_editSqlParamAdd()" :disabled="sqlParams.operDisabled.buttonE"  type="text"     native-type="button">编辑(E)</el-button>
<el-button size="medium"  v-if="sqlParams.operVisible.buttonD==undefined || sqlParams.operVisible.buttonD" @click="sqlParams_delete()" :disabled="sqlParams.operDisabled.buttonD"  type="text"     native-type="button">删除(D)</el-button>
</div>
    <div></div>
</div>
<div class="ac-table-content">
    <el-table row-key="id" highlight-current-row stripe show-header border  
    :data="sqlParams.data" size="mini" ref="sqlParams"
       
    height="100%"
    @current-change="sqlParams_currentChange">
    <el-table-column prop="sortNo" label="排序" width="70"   align="left" sortable show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.sortNo}}
   </template>
</el-table-column>
<el-table-column prop="operType" label="比较方式" width="90"   align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        <template v-if="scope.row.operType=='eq'">=</template><template v-else-if="scope.row.operType=='ne'">&lt;&gt;</template><template v-else-if="scope.row.operType=='gt'">&gt;</template><template v-else-if="scope.row.operType=='ge'">&gt;=</template><template v-else-if="scope.row.operType=='lt'">&lt;</template><template v-else-if="scope.row.operType=='le'">&lt;=</template><template v-else-if="scope.row.operType=='like'">like</template><template v-else-if="scope.row.operType=='notLike'">not like</template><template v-else-if="scope.row.operType=='in'">in</template><template v-else-if="scope.row.operType=='notIn'">not in</template><template v-else>{{scope.row.operType}}</template>
   </template>
</el-table-column>
<el-table-column prop="columnName" label="列名/where语句"    align="left"   >
   <template slot-scope="scope">
        {{scope.row.columnName}}
   </template>
</el-table-column>
<el-table-column prop="parameter" label="参数" width="150"   align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.parameter}}
   </template>
</el-table-column>
<el-table-column prop="defaultValue" label="默认值" width="90"   align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.defaultValue}}
   </template>
</el-table-column>
<el-table-column prop="isWhere" label="where条件" width="90"   align="center"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.isWhere}}
   </template>
</el-table-column>

</el-table>

</div>
          
</el-tab-pane>
<el-tab-pane label="结果转换" name="tab2" :disabled="tabDisabled.tab2" v-if="tabVisible.tab2" >
<div class="flex ac-table-head">
    <div class="ac-table-oper"><el-button size="medium"  v-if="resultConversion.operVisible.buttonA==undefined || resultConversion.operVisible.buttonA" @click="resultConversion_openResultConversionAdd()" :disabled="resultConversion.operDisabled.buttonA"  type="text"     native-type="button">添加(A)</el-button>
<el-button size="medium"  v-if="resultConversion.operVisible.buttonD==undefined || resultConversion.operVisible.buttonD" @click="resultConversion_delete()" :disabled="resultConversion.operDisabled.buttonD"  type="text"     native-type="button">删除(D)</el-button>
</div>
    <div></div>
</div>
<div class="ac-table-content">
    <el-table row-key="id" highlight-current-row stripe show-header border  
    :data="resultConversion.data" size="mini" ref="resultConversion"
       
    height="100%"
    @current-change="resultConversion_currentChange">
    <el-table-column type="index" width="50" label="序号"></el-table-column>
<el-table-column prop="fieldName" label="列名"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.fieldName}}
   </template>
</el-table-column>
<el-table-column prop="resultType" label="结果类型"    align="left"  show-overflow-tooltip class-name="editorCell">
   <template slot-scope="scope">
        <el-select v-model="scope.row.resultType" size="small" clearable placeholder="请选择"     @change="resultConversion_change('resultType',scope.row)">
    <el-option label="字符串数组" value="StrArray"></el-option><el-option label="整形数组" value="IntArray"></el-option><el-option label="JSON数组" value="JSONArray"></el-option><el-option label="JSON对象" value="JSONObject"></el-option>
</el-select>

   </template>
</el-table-column>

</el-table>

</div>
          
</el-tab-pane>

</el-tabs>

</div>
</div>
</div>

<el-dialog :visible.sync="sqlAdd.visible" :title="sqlAdd.title"
            width="50%"
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;">
                <el-form class=""  label-width="100px" label-position="right"
     size="mini" ref="sqlAdd" :model="sqlAdd.data" :rules="sqlAdd.rules"  
     :disabled="sqlAdd.disabled" >
    <el-row><el-col :span=24 v-if="sqlAdd.itemVisible.categoryCode==undefined || sqlAdd.itemVisible.categoryCode">
    <el-form-item prop="categoryCode" label="数据源目录">
        <el-cascader v-model="sqlAdd.data.categoryCode" placeholder="请选择" :options="customOptions.funcCategory" size="mini" clearable  :disabled="sqlAdd.editorForm || sqlAdd.itemDisabled.categoryCode"    :props="{multiple:false,checkStrictly:false}"></el-cascader>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlAdd.itemVisible.code==undefined || sqlAdd.itemVisible.code">
    <el-form-item prop="code" label="数据源代码">
        
<el-input type="text" size="mini"  v-model="sqlAdd.data.code" placeholder="数据源代码" :disabled="sqlAdd.editorForm || sqlAdd.itemDisabled.code"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlAdd.itemVisible.label==undefined || sqlAdd.itemVisible.label">
    <el-form-item prop="label" label="数据源名称">
        
<el-input type="text" size="mini"  v-model="sqlAdd.data.label" placeholder="数据源名称" :disabled="sqlAdd.itemDisabled.label"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlAdd.itemVisible.selectTable==undefined || sqlAdd.itemVisible.selectTable">
    <el-form-item prop="selectTable" label="查询表">
        <el-input type="textarea" size="mini"  v-model="sqlAdd.data.selectTable" placeholder="查询表" :rows="2" :autosize="false" :disabled="sqlAdd.itemDisabled.selectTable"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlAdd.itemVisible.selectColumn==undefined || sqlAdd.itemVisible.selectColumn">
    <el-form-item prop="selectColumn" label="查询列">
        <el-input type="textarea" size="mini"  v-model="sqlAdd.data.selectColumn" placeholder="查询列" :rows="2" :autosize="false" :disabled="sqlAdd.itemDisabled.selectColumn"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlAdd.itemVisible.orderBy==undefined || sqlAdd.itemVisible.orderBy">
    <el-form-item prop="orderBy" label="order by">
        
<el-input type="text" size="mini"  v-model="sqlAdd.data.orderBy" placeholder="order by" :disabled="sqlAdd.itemDisabled.orderBy"  ></el-input>

        
    </el-form-item>
</el-col>
</el-row>
 </el-form>

            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="sqlAdd_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="sqlAdd_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="changeCategory.visible" :title="changeCategory.title"
            width="400px"
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;">
                <el-form class=""  label-width="120px" label-position="right"
     size="mini" ref="changeCategory" :model="changeCategory.data" :rules="changeCategory.rules"  
     :disabled="changeCategory.disabled" >
    <el-row><el-col :span=24 v-if="changeCategory.itemVisible.categoryCode==undefined || changeCategory.itemVisible.categoryCode">
    <el-form-item prop="categoryCode" label="数据源目录">
        <el-cascader v-model="changeCategory.data.categoryCode" placeholder="请选择" :options="customOptions.funcCategory" size="mini" clearable  :disabled="changeCategory.itemDisabled.categoryCode"    :props="{multiple:false,checkStrictly:false}"></el-cascader>

        
    </el-form-item>
</el-col>
</el-row>
 </el-form>

            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="changeCategory_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="changeCategory_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="sqlEdit.visible" :title="sqlEdit.title"
            width="50%"
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;">
                <el-form class=""  label-width="100px" label-position="right"
     size="mini" ref="sqlEdit" :model="sqlEdit.data" :rules="sqlEdit.rules"  
     :disabled="sqlEdit.disabled" >
    <el-row><el-col :span=24 v-if="sqlEdit.itemVisible.code==undefined || sqlEdit.itemVisible.code">
     <el-form-item label="数据源代码">
    {{sqlEdit.data.categoryCode}}.{{sqlEdit.data.code}}
</el-form-item>
</el-col>
<el-col :span=24 v-if="sqlEdit.itemVisible.label==undefined || sqlEdit.itemVisible.label">
    <el-form-item prop="label" label="数据源名称">
        
<el-input type="text" size="mini"  v-model="sqlEdit.data.label" placeholder="数据源名称" :disabled="sqlEdit.itemDisabled.label"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlEdit.itemVisible.selectTable==undefined || sqlEdit.itemVisible.selectTable">
    <el-form-item prop="selectTable" label="查询表">
        <el-input type="textarea" size="mini"  v-model="sqlEdit.data.selectTable" placeholder="查询表" :rows="2" :autosize="false" :disabled="sqlEdit.itemDisabled.selectTable"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlEdit.itemVisible.selectColumn==undefined || sqlEdit.itemVisible.selectColumn">
    <el-form-item prop="selectColumn" label="查询列">
        <el-input type="textarea" size="mini"  v-model="sqlEdit.data.selectColumn" placeholder="查询列" :rows="2" :autosize="false" :disabled="sqlEdit.itemDisabled.selectColumn"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlEdit.itemVisible.orderBy==undefined || sqlEdit.itemVisible.orderBy">
    <el-form-item prop="orderBy" label="order by">
        
<el-input type="text" size="mini"  v-model="sqlEdit.data.orderBy" placeholder="order by" :disabled="sqlEdit.itemDisabled.orderBy"  ></el-input>

        
    </el-form-item>
</el-col>
</el-row>
 </el-form>

            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="sqlEdit_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="sqlEdit_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="resultConversionAdd.visible" :title="resultConversionAdd.title"
            width="50%"
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;">
                <el-form class=""  label-width="80px" label-position="right"
     size="mini" ref="resultConversionAdd" :model="resultConversionAdd.data" :rules="resultConversionAdd.rules"  
     :disabled="resultConversionAdd.disabled" >
    <el-row><el-col :span=24 v-if="resultConversionAdd.itemVisible.fieldName==undefined || resultConversionAdd.itemVisible.fieldName">
    <el-form-item prop="fieldName" label="查询列名">
        
<el-input type="text" size="mini"  v-model="resultConversionAdd.data.fieldName" placeholder="查询列名" :disabled="resultConversionAdd.itemDisabled.fieldName"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="resultConversionAdd.itemVisible.resultType==undefined || resultConversionAdd.itemVisible.resultType">
    <el-form-item prop="resultType" label="结果类型">
        <el-select v-model="resultConversionAdd.data.resultType" placeholder="请选择" size="mini" :disabled="resultConversionAdd.itemDisabled.resultType" clearable      >
   <el-option label="字符串数组" value="StrArray"></el-option><el-option label="整型数组" value="IntArray"></el-option><el-option label="JSON数组" value="JSONArray"></el-option><el-option label="JSON对象" value="JSONObject"></el-option>
</el-select>

        
    </el-form-item>
</el-col>
</el-row>
 </el-form>

            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="resultConversionAdd_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="resultConversionAdd_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="sqlParamAdd.visible" :title="sqlParamAdd.title"
            width="50%"
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;">
                <el-form class=""  label-width="100px" label-position="right"
     size="mini" ref="sqlParamAdd" :model="sqlParamAdd.data" :rules="sqlParamAdd.rules"  
     :disabled="sqlParamAdd.disabled" >
    <el-row><el-col :span=12 v-if="sqlParamAdd.itemVisible.isWhere==undefined || sqlParamAdd.itemVisible.isWhere">
    <el-form-item prop="isWhere" label="where语句">
        <el-checkbox  v-model="sqlParamAdd.data.isWhere"  size="mini"  true-label="Y"  false-label="N" :disabled="sqlParamAdd.itemDisabled.isWhere"  ></el-checkbox>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlParamAdd.itemVisible.columnName==undefined || sqlParamAdd.itemVisible.columnName">
    <el-form-item prop="columnName" label="列名/where语句">
        <el-input type="textarea" size="mini"  v-model="sqlParamAdd.data.columnName" placeholder="列名/where语句" :rows="2" :autosize="false" :disabled="sqlParamAdd.itemDisabled.columnName"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlParamAdd.itemVisible.parameter==undefined || sqlParamAdd.itemVisible.parameter">
    <el-form-item prop="parameter" label="绑定参数">
        <el-input type="textarea" size="mini"  v-model="sqlParamAdd.data.parameter" placeholder="绑定参数" :rows="2" :autosize="false" :disabled="sqlParamAdd.itemDisabled.parameter"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlParamAdd.itemVisible.name==undefined || sqlParamAdd.itemVisible.name">
    <el-form-item prop="name" label="">
        <span style="color:red;">多个绑定参数使用，隔开</span>

        
    </el-form-item>
</el-col>
<el-col :span=12 v-if="sqlParamAdd.itemVisible.operType==undefined || sqlParamAdd.itemVisible.operType">
    <el-form-item prop="operType" label="比较方式">
        <el-select v-model="sqlParamAdd.data.operType" placeholder="请选择" size="mini" :disabled="sqlParamAdd.itemDisabled.operType" clearable      >
   <el-option label="=" value="eq"></el-option><el-option label="<>" value="ne"></el-option><el-option label=">" value="gt"></el-option><el-option label=">=" value="ge"></el-option><el-option label="<" value="lt"></el-option><el-option label="<=" value="le"></el-option><el-option label="like" value="like"></el-option><el-option label="not like" value="notLike"></el-option><el-option label="in" value="in"></el-option><el-option label="not in" value="notIn"></el-option>
</el-select>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="sqlParamAdd.itemVisible.defaultValue==undefined || sqlParamAdd.itemVisible.defaultValue">
    <el-form-item prop="defaultValue" label="默认值">
        
<el-input type="text" size="mini"  v-model="sqlParamAdd.data.defaultValue" placeholder="默认值" :disabled="sqlParamAdd.itemDisabled.defaultValue"  ></el-input>

        
    </el-form-item>
</el-col>
</el-row>
 </el-form>

            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="sqlParamAdd_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="sqlParamAdd_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>


</div>

</body>
<script th:inline="javascript">
    let vm = new Vue({
            el: '#app',
            data() {
                return {"resultConversion":{"title":"结果转换","currentRow":{},"data":[],"expandRowKeys":[],"pagingData":{},"operData":{},"operVisible":{},"operDisabled":{},"rawData":[],"itemVisible":{},"operDialogVisible":false},"sqlParams":{"title":"参数设置","currentRow":{},"data":[],"expandRowKeys":[],"pagingData":{},"operData":{},"operVisible":{},"operDisabled":{},"rawData":[],"itemVisible":{},"operDialogVisible":false},"sqlDetail":{"title":"基本信息","data":{},"operData":{},"operVisible":{},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{},"itemDisabled":{},"transfer":{},"rules":{"code":[{"required":true,"message":"请输入数据源代码","trigger":"blur"}],"label":[{"required":true,"message":"请输入数据源名称","trigger":"blur"}]}},"sqlTree":{"title":"sql列表","data":[],"filterValue":"","defaultCheckedKeys":[],"currentNodeKey":{},"operData":{},"operVisible":{},"operDisabled":{},"currentRow":{}},"page":{"tabs":"tab1"},"tabDisabled":{"tab1":false,"tab2":false},"tabVisible":{"tab1":true,"tab2":true},"customOptions":{},"dictOptions":{},"sqlAdd":{"visible":false,"title":"添加SQL","data":{"selectColumn":"*"},"operData":{},"operVisible":{},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{},"itemDisabled":{},"transfer":{},"rules":{"categoryCode":[{"required":true,"message":"请输入数据源目录","trigger":"blur"}],"code":[{"required":true,"message":"请输入数据源代码","trigger":"blur"}],"label":[{"required":true,"message":"请输入数据源名称","trigger":"blur"}]}},"changeCategory":{"visible":false,"title":"更改SQL目录","data":{},"operData":{},"operVisible":{},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{},"itemDisabled":{},"transfer":{},"rules":{"categoryCode":[{"required":true,"message":"请输入数据源目录","trigger":"blur"}]}},"sqlEdit":{"visible":false,"title":"编辑SQL","data":{"selectColumn":"*"},"operData":{},"operVisible":{},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{},"itemDisabled":{},"transfer":{},"rules":{"code":[{"required":true,"message":"请输入数据源代码","trigger":"blur"}],"label":[{"required":true,"message":"请输入数据源名称","trigger":"blur"}]}},"resultConversionAdd":{"visible":false,"title":"添加转换规则","data":{},"operData":{},"operVisible":{},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{},"itemDisabled":{},"transfer":{},"rules":{"fieldName":[{"required":true,"message":"请输入查询列名","trigger":"blur"}],"resultType":[{"required":true,"message":"请输入结果类型","trigger":"blur"}]}},"sqlParamAdd":{"visible":false,"title":"添加参数","data":{"isWhere":"N"},"operData":{},"operVisible":{},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{},"itemDisabled":{},"transfer":{},"rules":{"columnName":[{"required":true,"message":"请输入列名/where语句","trigger":"blur"}],"operType":[{"required":true,"message":"请输入比较方式","trigger":"blur"}]}}}
            },
            watch: {
"sqlTree.filterValue":function(val){
	this.$refs.sqlTree.filter(val);
}},
            methods: {
sqlParams_currentChange:function(currentRow){
    if(!currentRow){
        //如果没有传入值，则将当前的选中值清空
        this.$data.sqlParams.currentRow = this.$options.data().sqlParams.currentRow;
    }else{
        this.sqlParams.currentRow = currentRow;
    }
    this.sqlParams_operCtrl(currentRow);
},
sqlAdd_load:function(){
    let that = this;
    HttpApi.post("/zzdesign/design/load",this.sqlAdd.operData,function(res){
        that.sqlAdd.data = res;
    });
},
sqlParamAdd_change:function(fieldName){
    HttpApi.updateProvider("",fieldName,this.sqlParamAdd.data,function(){

    });
},
sqlEdit_dialogOpen:function(param,callback){
    this.$data.sqlEdit.data = this.$options.data().sqlEdit.data;
    this.$data.sqlEdit.operData = this.$options.data().sqlEdit.operData;
    for(let val in param) {
        this.$set(this.sqlEdit.data, val, param[val])
    }
    this.sqlEdit.callback=callback;
    this.sqlEdit.visible = true;
}
,
changeCategory_dialogCancel:function(){
     this.changeCategory.visible = false;
},
sqlAdd_dialogOpen:function(param,callback){
    this.$data.sqlAdd.data = this.$options.data().sqlAdd.data;
    this.$data.sqlAdd.operData = this.$options.data().sqlAdd.operData;
    for(let val in param) {
        this.$set(this.sqlAdd.data, val, param[val])
    }
    this.sqlAdd.callback=callback;
    this.sqlAdd.visible = true;
}
,
sqlAdd_dialogCancel:function(){
     this.sqlAdd.visible = false;
},
changeCategory_dialogOk:function(){
    let that = this;
    this.$refs.changeCategory.validate(function(valid){
        if(valid){
            that.changeCategory.callback(that.changeCategory.data);
        }else{
            return false;
        }
    });
},
sqlDetail_change:function(fieldName) {
    HttpApi.post("/platform/qbe/update/" + fieldName, this.sqlDetail.data, function() {

    });
},
sqlEdit_dialogCancel:function(){
     this.sqlEdit.visible = false;
},
resultConversion_currentChange:function(currentRow){
    if(!currentRow){
        //如果没有传入值，则将当前的选中值清空
        this.$data.resultConversion.currentRow = this.$options.data().resultConversion.currentRow;
    }else{
        this.resultConversion.currentRow = currentRow;
    }
    this.resultConversion_operCtrl(currentRow);
},
resultConversionAdd_dialogCancel:function(){
     this.resultConversionAdd.visible = false;
},
sqlTree_nodeClick:function(data,node){
    this.sqlTree.currentNodeKey=data.id;
},
sqlEdit_dialogOk:function(){
    let that = this;
    this.$refs.sqlEdit.validate(function(valid){
        if(valid){
            that.sqlEdit.callback(that.sqlEdit.data);
        }else{
            return false;
        }
    });
},
sqlParamAdd_dialogCancel:function(){
     this.sqlParamAdd.visible = false;
},
sqlAdd_change:function(fieldName){
    HttpApi.updateProvider("",fieldName,this.sqlAdd.data,function(){

    });
},
sqlParamAdd_dialogOpen:function(param,callback){
    this.$data.sqlParamAdd.data = this.$options.data().sqlParamAdd.data;
    this.$data.sqlParamAdd.operData = this.$options.data().sqlParamAdd.operData;
    for(let val in param) {
        this.$set(this.sqlParamAdd.data, val, param[val])
    }
    this.sqlParamAdd.callback=callback;
    this.sqlParamAdd.visible = true;
}
,
resultConversion_load:function() {
    let that = this;
    HttpApi.post("/platform/qbe/queryResultConversion", that.resultConversion.operData, function(res) {
        that.resultConversion.data = res;
        if (that.resultConversion.data.length > 0) {
            that.$refs.resultConversion.setCurrentRow(that.resultConversion.data[0]);
            that.resultConversion_operCtrl(that.resultConversion.data[0]);
        } else {
            that.$refs.resultConversion.setCurrentRow();
            that.resultConversion_operCtrl();
        }
    });
},
sqlParams_delete: function() {
     let that = this;
     let id = this.sqlParams.currentRow.id;
     if (id) {
         HttpApi.postConfirm("/platform/qbe/delParam", this.sqlParams.currentRow, function(res) {
             let index = that.sqlParams.data.findIndex(function(item) {
                 return item.id == id;
             });

             that.sqlParams.data.splice(index, 1);
             if (that.sqlParams.data.length == 0) {
                 that.$data.sqlParams.currentRow = that.$options.data().sqlParams.currentRow;
                 that.$refs.sqlParams.setCurrentRow();
             } else if (that.sqlParams.data.length > index) {
                 that.$refs.sqlParams.setCurrentRow(that.sqlParams.data[index]);
             } else {
                 that.$refs.sqlParams.setCurrentRow(that.sqlParams.data[index - 1]);
             }
             that.$message.success("删除成功");
         });
     } else {
         that.$alert("请选择要删除的数据");
     }
 },
changeCategory_dialogOpen:function(param,callback){
    this.$data.changeCategory.data = this.$options.data().changeCategory.data;
    this.$data.changeCategory.operData = this.$options.data().changeCategory.operData;
    for(let val in param) {
        this.$set(this.changeCategory.data, val, param[val])
    }
    this.changeCategory.callback=callback;
    this.changeCategory.visible = true;
}
,
sqlParams_change:function(fieldName,row){
    HttpApi.updateProvider("",fieldName,row,function(){
                        
    });
},
sqlTree_load:function() {
    let that = this;
    HttpApi.post("/platform/qbe/load", that.sqlTree.operData, function(treeData) {
        that.sqlTree.data = treeData;
    });
},
resultConversionAdd_change:function(fieldName){
    HttpApi.updateProvider("",fieldName,this.resultConversionAdd.data,function(){

    });
},
sqlTree_allowDrag:function(node){
    return true;
},
resultConversionAdd_load:function(){
    let that = this;
    HttpApi.post("/zzdesign/design/load",this.resultConversionAdd.operData,function(res){
        that.resultConversionAdd.data = res;
    });
},
resultConversion_operCtrl:function(currentRow) {
    /**
    * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
    * this.$set(this.stdSolReceiveHistory.operDisabled, "buttonE", true);
    * operVisible：控制按钮是否显示，true代表显示，false代表不显示
    * this.$set(this.stdSolReceiveHistory.operVisible, "buttonE", false);
    */
    if(!currentRow) {
       this.$set(this.resultConversion.operDisabled, "buttonD", true);//删除(D)

    }else {
       this.$set(this.resultConversion.operDisabled, "buttonD", false);//删除(D)

    }
},
sqlTree_currentChange:function(data, node) {
    if (data) {
        this.sqlTree.currentNodeKey = data.id;
        this.sqlTree.currentRow = data;
        this.sqlDetail.editorForm = true;
        this.sqlDetail.operData.id = this.sqlTree.currentRow.id;
        this.sqlDetail_load();

        this.sqlParams.operData.datasourceId = this.sqlTree.currentRow.id;
        this.sqlParams_load();

        this.resultConversion.operData.datasourceId = this.sqlTree.currentRow.id;
        this.dresultConversion_load();

    } else {
        this.$data.sqlTree.currentNodeKey = this.$options.data().sqlTree.currentNodeKey;
        this.$data.sqlTree.currentRow = this.$options.data().sqlTree.currentRow;
        this.$data.sqlDetail.operData = this.$options.data().sqlDetail.operData;
        this.$data.sqlDetail.data = this.$options.data().sqlDetail.data;

        this.$data.sqlParams.operData = this.$options.data().sqlParams.operData;
        this.$data.sqlParams.data = this.$options.data().sqlParams.data;

        this.$data.resultConversion.operData = this.$options.data().resultConversion.operData;
        this.$data.resultConversion.data = this.$options.data().resultConversion.data;

    }
},
sqlEdit_load:function(){
    let that = this;
    HttpApi.post("/zzdesign/design/load",this.sqlEdit.operData,function(res){
        that.sqlEdit.data = res;
    });
},
changeCategory_change:function(fieldName){
    HttpApi.updateProvider("",fieldName,this.changeCategory.data,function(){

    });
},
sqlTree_checkChange:function(){
    //没有定义方法模板，需要手动编辑
}
,
sqlTree_editChangeCategory:function(){
    let that = this;
    this.changeCategory.editorForm = true;
    if(!this.sqlTree.currentRow.id){
        this.$alert("请先选中一条sql列表信息");
        return;
    }else{
        this.changeCategory_dialogOpen(this.sqlTree.currentRow,function(dialogData){
            HttpApi.saveProvider("",dialogData,function(res){
                that.changeCategory.visible = false;
            });
        })
    }
},
sqlAdd_dialogOk:function(){
    let that = this;
    this.$refs.sqlAdd.validate(function(valid){
        if(valid){
            that.sqlAdd.callback(that.sqlAdd.data);
        }else{
            return false;
        }
    });
},
resultConversionAdd_dialogOk:function(){
    let that = this;
    this.$refs.resultConversionAdd.validate(function(valid){
        if(valid){
            that.resultConversionAdd.callback(that.resultConversionAdd.data);
        }else{
            return false;
        }
    });
},
sqlParams_editSqlParamAdd:function() {
    let that = this;
    this.sqlParamAdd.editorForm = true;
    if (!this.sqlParams.currentRow.id) {
        this.$alert("请先选中一条参数设置信息");
        return;
    } else {
        this.sqlParamAdd_dialogOpen(this.sqlParams.currentRow, function(dialogData) {
            HttpApi.post("/platform/qbe/saveParam", dialogData, function(res) {
                let index = that.sqlParams.data.findIndex(function(item) {
                    return item.id == res.id;
                });
                that.$set(that.sqlParams.data, index, res);
                that.$refs.sqlParams.setCurrentRow(res);
                that.sqlParamAdd.visible = false;
            });
        })
    }
},
sqlParams_openSqlParamAdd:function() {
    let that = this;
    let datasourceId = this.sqlParams.operData.datasourceId;
    if (datasourceId) {
        this.sqlParamAdd.editorForm = false;
        let param = {};
        param.datasourceId = datasourceId;
        this.sqlParamAdd_dialogOpen(param, function(dialogData) {
            HttpApi.post("/platform/qbe/saveParam", dialogData, function(res) {
                that.sqlParams.data.push(res);
                that.$refs.sqlParams.setCurrentRow(res);
                that.sqlParamAdd.visible = false;
            });
        })
    } else {
        this.$alert("请选择一条数据源记录");
    }

},
sqlTree_treeCommand:function(param) {
    let that = this;
    if (param.flag == "addChildren") {
        let dialogParam = {};
        dialogParam.parentId = param.nodeData.id;
        /*添加子节点执行的函数
        that.{dialogCode}_dialogOpen(dialogParam,function(dailogData){
            HttpApi.saveProvider("dataSourceTree",dailogData,function(res){
                if(res.parentId=="-1"){
                    that.sqlTree.data.push(res);
                }else{
                    that.$refs.sqlTree.append(res,res.parentId);
                }
                that.{dialogCode}.visible = false;
            });
        })
        */
    }
    if (param.flag == "del") {
        HttpApi.postConfirm("/platform/qbe/delete", param.nodeData, function(res) {
            that.$refs.sqlTree.remove(param.nodeData);
            that.sqlTree_currentChange();
        });
    }

    if (param.flag == 'changeCategory') {
        this.changeCategory.editorForm = true;
        this.changeCategory_dialogOpen({}, function(dialogData) {
            dialogData.id = param.nodeData.id;
            HttpApi.post("/platform/qbe/changeCategory", dialogData, function(res) {
                that.sqlTree_load();
                that.changeCategory.visible = false;
            });
        })
    }
},
sqlEdit_change:function(fieldName){
    HttpApi.updateProvider("",fieldName,this.sqlEdit.data,function(){

    });
},
resultConversion_change:function(fieldName, row) {
    HttpApi.post("/platform/qbe/changeResultConversion/" + fieldName, row, function() {

    });
},
sqlDetail_editSqlEdit: function() {
     let that = this;
     this.sqlEdit.editorForm = true;
     this.sqlEdit_dialogOpen(this.sqlDetail.data, function(dialogData) {
         HttpApi.post("/platform/qbe/add", dialogData, function(res) {
             that.sqlDetail.data = res;
             that.sqlEdit.visible = false;
         });
     })
 },
sqlParamAdd_dialogOk:function(){
    let that = this;
    this.$refs.sqlParamAdd.validate(function(valid){
        if(valid){
            that.sqlParamAdd.callback(that.sqlParamAdd.data);
        }else{
            return false;
        }
    });
},
sqlTree_check:function(node,list){
        
},
resultConversion_openResultConversionAdd:function() {
    let that = this;
    let datasourceId = this.resultConversion.operData.datasourceId;
    if(datasourceId){
        this.resultConversionAdd.editorForm = false;
        let param = {};
        param.datasourceId = datasourceId;
        this.resultConversionAdd_dialogOpen(param, function(dialogData) {
            HttpApi.post("/platform/qbe/saveResultConversion", dialogData, function(res) {
                that.resultConversion.data.push(res);
                that.$refs.resultConversion.setCurrentRow(res);
                that.resultConversionAdd.visible = false;
            });
        })
    }else{
        this.$alert("请选择一条数据源记录");
    }
},
sqlParams_load:function() {
    let that = this;

    HttpApi.post("/platform/qbe/queryParams", that.sqlParams.operData, function(res) {
        that.sqlParams.data = res;
        if (that.sqlParams.data.length > 0) {
            that.$refs.sqlParams.setCurrentRow(that.sqlParams.data[0]);
            that.sqlParams_operCtrl(that.sqlParams.data[0]);
        } else {
            that.$refs.sqlParams.setCurrentRow();
            that.sqlParams_operCtrl();
        }
    });
},
sqlTree_nodeDrop:function(draggingNode, dropNode, dropType, ev){
	let that = this;
	/*共四个参数，依次为：被拖拽节点对应的 Node、结束拖拽时最后进入的节点、
	    被拖拽节点的放置位置（before、after、inner）、event	*/
	
},
sqlParams_operCtrl:function(currentRow) {
    /**
    * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
    * this.$set(this.stdSolReceiveHistory.operDisabled, "buttonE", true);
    * operVisible：控制按钮是否显示，true代表显示，false代表不显示
    * this.$set(this.stdSolReceiveHistory.operVisible, "buttonE", false);
    */
    if(!currentRow) {
       this.$set(this.sqlParams.operDisabled, "buttonE", true);//编辑(E)
this.$set(this.sqlParams.operDisabled, "buttonD", true);//删除(D)

    }else {
       this.$set(this.sqlParams.operDisabled, "buttonE", false);//编辑(E)
this.$set(this.sqlParams.operDisabled, "buttonD", false);//删除(D)

    }
},
sqlParamAdd_load:function(){
    let that = this;
    HttpApi.post("/zzdesign/design/load",this.sqlParamAdd.operData,function(res){
        that.sqlParamAdd.data = res;
    });
},
resultConversion_delete: function() {
     let that = this;
     let id = this.resultConversion.currentRow.id;
     if (id) {
         HttpApi.postConfirm("/platform/qbe/delResultConversion", this.resultConversion.currentRow, function(res) {
             let index = that.resultConversion.data.findIndex(function(item) {
                 return item.id == id;
             });

             that.resultConversion.data.splice(index, 1);
             if (that.resultConversion.data.length == 0) {
                 that.$data.resultConversion.currentRow = that.$options.data().resultConversion.currentRow;
                 that.$refs.resultConversion.setCurrentRow();
             } else if (that.resultConversion.data.length > index) {
                 that.$refs.resultConversion.setCurrentRow(that.resultConversion.data[index]);
             } else {
                 that.$refs.resultConversion.setCurrentRow(that.resultConversion.data[index - 1]);
             }
             that.$message.success("删除成功");
         });
     } else {
         that.$alert("请选择要删除的数据");
     }
 },
resultConversionAdd_dialogOpen:function(param,callback){
    this.$data.resultConversionAdd.data = this.$options.data().resultConversionAdd.data;
    this.$data.resultConversionAdd.operData = this.$options.data().resultConversionAdd.operData;
    for(let val in param) {
        this.$set(this.resultConversionAdd.data, val, param[val])
    }
    this.resultConversionAdd.callback=callback;
    this.resultConversionAdd.visible = true;
}
,
sqlDetail_load:function() {
    let that = this;
    HttpApi.post("/platform/qbe/querySqlDetail", this.sqlDetail.operData, function(res) {
        that.sqlDetail.data = res;
    });
},
sqlTree_allowDrop:function(draggingNode, dropNode, type){
    /*拖拽时判定目标节点能否被放置。
    type ：'prev'、'inner' 和 'next'，
    分别表示放置在目标节点前、插入至目标节点和放置在目标节点后*/
},
sqlTree_openSqlAdd:function() {
    let that = this;
    this.sqlAdd.editorForm = false;
    let param = {};
    this.sqlAdd_dialogOpen(param, function(dialogData) {
        HttpApi.post("/platform/qbe/add", dialogData, function(res) {
            that.sqlTree_load();
            that.sqlAdd.visible = false;
        });
    })
},
sqlTree_filterNodeMethod:function(value, data) {
    if (!value) return true;
    return data.label.toLowerCase().indexOf(value.toLowerCase()) !== -1;
},
changeCategory_load:function(){
    let that = this;
    HttpApi.post("/zzdesign/design/load",this.changeCategory.operData,function(res){
        that.changeCategory.data = res;
    });
}
},
            mounted: function(){
    dragControllerLR();
    dragControllerUD();
},
            created: function(){
    let that=this;
    //获取字典信息
    HttpApi.dictOptions([],function(res){
        that.dictOptions=res;
    });

    //加载自定义数据字典
    /** 这是注释信息，需要添加注释**/
HttpApi.post2("/platform/qbe/funcCategory", {}, function(res) {
    that.$set(that.customOptions, "funcCategory", res);
});


    //加载初始化load
    this.sqlTree_load();


    //加载初始化方法
    
}
    });
</script>
</html>
